<HTML><HEAD><TITLE>reverse_graph(+Graph, ?ReverseGraph)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(grasper)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>reverse_graph(+Graph, ?ReverseGraph)</H1>
Obtains the reverse graph of a given graph.
<DL>
<DT><EM>Graph</EM></DT>
<DD>A graph.
</DD>
<DT><EM>ReverseGraph</EM></DT>
<DD>The reverse graph of Graph.
</DD>
</DL>
<H2>Description</H2>
Obtains the reverse graph of a given graph.
<H3>Fail Conditions</H3>
Fails 
			 if Graph is not a graph variable or
			 if Graph can not be contrained to have ReverseGraph as its reverse graph (ReverseGraph is a graph variable).
			
<H2>Examples</H2>
<PRE>
?- reverse_graph(G,RG).
No.

?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], dirgraph(G,V,E), dirgraph(RG,V,E), reverse_graph(G,RG).
No.

?- V`::[]..[1,2,3], E`::[]..[[1,2],[2,3],[3,1]], dirgraph(G,V,E), reverse_graph(G,RG), size(G,2), graph_labeling(G).
V = [1, 2, 3]
E = [[2, 3], [3, 1]]
G = dirgraph([1, 2, 3], [[2, 3], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [3, 2]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [3, 1]]
G = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [2, 1]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [2, 3]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
RG = dirgraph([1, 2, 3], [[2, 1], [3, 2]])
Yes

?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], RE`::[[3,2]]..[[1,3],[2,1],[3,2]], dirgraph(G,V,E), dirgraph(RG,V,RE), reverse_graph(G,RG), graph_labeling(G).
V = [1, 2, 3]
E = [[1, 2], [2, 3]]
RE = [[2, 1], [3, 2]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
RG = dirgraph([1, 2, 3], [[2, 1], [3, 2]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [2, 3], [3, 1]]
RE = [[1, 3], [2, 1], [3, 2]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [2, 1], [3, 2]])
Yes
			</PRE>

</BODY></HTML>
